package com.example.moblie2021606143cwj0408;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity8 extends AppCompatActivity {

    private TextView tvMainTitle8;
    private TextView tvMain14;
    private TextView tvMain15;
    private TextView tvMain16;
    private EditText edt7;
    private Button btn7;
    private TextView tvMainResult8;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main8);
        initView();
        btn7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String string = edt7.getText().toString();
                tvMainResult8.setText(String.valueOf(string.length()+"位数"));
                int b = Integer.parseInt(string);
               tvMainResult8.setText(String.valueOf(b)+" ");
                StringBuffer buffer = new StringBuffer(String.valueOf(b));
                tvMainResult8.setText(buffer.reverse());
            }
        });
    }

    private void initView() {
        tvMainTitle8 = findViewById(R.id.tv_main_title8);
        tvMain14 = findViewById(R.id.tv_main14);
        tvMain15 = findViewById(R.id.tv_main15);
        tvMain16 = findViewById(R.id.tv_main16);
        edt7 = findViewById(R.id.edt7);
        btn7 = findViewById(R.id.btn7);
        tvMainResult8 = findViewById(R.id.tv_main_result8);
    }
}